<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>                                                                                                                                 
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>                                                                                                        
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">                                                                                          
<html>                                                                                                                                                                                              
<head>                                                                                                                                                                                              
<title>${po.comment}管理</title>                                                                                                                                                                    
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">                                                                                                                             
<meta name="viewport" content="width=device-width, initial-scale=1.0">                                                                                                                          
<meta http-equiv="X-UA-Compatible" content="IE=Edge">                                                                                                                                           
<link href="http://apps.bdimg.com/libs/bootstrap/3.3.0/css/bootstrap.css" rel="stylesheet">                                                                                                     
<link href="http://apps.bdimg.com/libs/bootstrap-glyphicons/1.0/css/bootstrap-glyphicons.css" rel="stylesheet">                                                                                 
</head>                                                                                                                                                                                             
<body>                                                                                                                                                                                              
		<jsp:include page="header.jsp"></jsp:include>    
<div class="container-fluid">                                                                                                                                                                                              
	<div class="row">                                                                                                                                                                                              
		<div class="col-sm-2">                                                                                                                                                                                              
		<jsp:include page="catalog.jsp"></jsp:include>                                                                                                                                                                                              
		</div>                                                                                                                                                                                              
		<div class="col-sm-10">                                                                                                                                                                                              
	<H3 class=" col-sm-12">${po.comment}管理:</H3>                                                                                                                                    
	<div class="col-sm-12">                                                                                                                                                          
		<form id="Bala_filesForm" method="post">                                                                                                                                                                   
			<input type="hidden" name="id" id="id" value="${po.id}" />                                                                                                                         
			<c:forEach var="entry" items="${po.commentMap}" varStatus="status">                                                                                                                  
				<div class="form-group">                                                                                                                                                             
					<label for="inputEmail3" class="col-sm-1 control-label text-right" style="padding: 0px;">${entry.value.comment}:</label>                                                             
					<div class="col-sm-2">                                                                                                                                                           
						<input type="text" class="form-control" style="padding: 0px; width: 100%; margin-bottom: 10px;" name="${entry.key}" id="${entry.key}" placeholder="${entry.value.comment}">
					</div>                                                                                                                                                                             
				</div>                                                                                                                                                                                 
			</c:forEach>                                                                                                                                                                               
			<div class="form-group">                                                                                                                                                                 
				<div class="col-sm-offset-9 col-sm-1 text-right">                                                                                                                                    
					<button id="addBala_files" type="button" class="btn btn-default">增加</button>                                                                                               
				</div>                                                                                                                                                                                 
			</div>                                                                                                                                                                                     
			<div class="form-group">                                                                                                                                                                 
				<div class="col-sm-1 text-right">                                                                                                                                                    
					<button id="selectBala_files" type="button" class="btn btn-default">查询</button>                                                                                            
				</div>                                                                                                                                                                                 
			</div>                                                                                                                                                                                     
			<div class="form-group">                                                                                                                                                                 
				<div class="col-sm-1 text-right">                                                                                                                                                    
					<button id="updateBala_files" type="button" class="btn btn-default">修改</button>                                                                                            
				</div>                                                                                                                                                                                 
			</div>                                                                                                                                                                                     
		</form>                                                                                                                                                                                        
	</div>                                                                                                                                                                                             
                                                                                                                                                                                                    
                                                                                                                                                                                                    
	<div class="col-sm-12">查询结果：</div>                                                                                                                                          
	<div class="col-sm-12">                                                                                                                                                          
		<table class="table table-striped table-bordered">                                                                                                                                           
			<tr>                                                                                                                                                                                       
				<c:forEach var="entry" items="${po.commentMap}" varStatus="status">                                                                                                              
					<c:if test="${status.first}">                                                                                                                                                    
						<td align="center">编号</td>                                                                                                                                                 
					</c:if>                                                                                                                                                                            
					<td align="center">${entry.value.comment}</td>                                                                                                                                           
					<c:if test="${status.last}">                                                                                                                                                     
						<td align="center">删除</td>                                                                                                                                                 
					</c:if>                                                                                                                                                                            
				</c:forEach>                                                                                                                                                                           
			</tr>                                                                                                                                                                                      
                                                                                                                                                                                                    
			<c:forEach var="pojo" items="${data}" varStatus="postatus">                                                                                                                          
				<tr>                                                                                                                                                                                   
					<c:forEach var="entry" items="${po.commentMap}" varStatus="status">                                                                                                          
						<c:if test="${status.first}">                                                                                                                                                
							<td align="center" id="Bala_filesdata!!!${postatus.count}!!!no">${postatus.count}</td>                                                                    
						</c:if>                                                                                                                                                                        
						<c:set var='entrykey' value="${entry.key}" scope="page" />                                                                                                                 
						<td align="center" id="Bala_filesdata!!!${postatus.count}!!!${entrykey}">${pojo[entrykey]}</td>                                                               
						<c:if test="${status.last}">                                                                                                                                                 
							<td align="center"><span id="delBala_files!!!${postatus.count}!!!${pojo.id}" class="glyphicon glyphicon-remove" style="cursor: pointer;"></span></td>              
						</c:if>                                                                                                                                                                        
					</c:forEach>                                                                                                                                                                       
				</tr>                                                                                                                                                                                  
			</c:forEach>                                                                                                                                                                               
		</table>                                                                                                                                                                                       
	</div> 
	<div class="col-sm-12">                                                                                                 
	<c:if test="${page.pageTotal>1}">                                                                                       
		<nav>                                                                                                                 
		  <ul class="pagination">                                                                                           
		  <c:if test="${page.pageIndex>1}">                                                                                 
		    <li>                                                                                                              
		      <a href="javascript:gotoPrePage()" aria-label="Previous">                                                   
		        <span aria-hidden="true">&laquo;</span>                                                                     
		      </a>                                                                                                            
		    </li>                                                                                                             
		    </c:if>                                                                                                           
		    <c:forEach var="i" begin="${(page.pageIndex-5)<2?1:(page.pageIndex-5)}" end="${page.pageIndex+5}">          
		    	<c:if test="${i>0 && i<=page.pageTotal}">                                                                   
	            <li><a href="javascript:gotoPage(${i})">${i}</a></li>                                                       
	            </c:if>                                                                                                       
	        </c:forEach>                                                                                                      
		    <c:if test="${page.pageIndex<page.pageTotal}">                                                                  
		    <li>                                                                                                              
		      <a href="javascript:gotoNextPage()" aria-label="Next">                                                      
		        <span aria-hidden="true">&raquo;</span>                                                                     
		      </a>                                                                                                            
		    </li>                                                                                                             
		    </c:if>                                                                                                           
		  </ul>                                                                                                               
		</nav>                                                                                                                
		</c:if>                                                                                                               
	</div>                                                                                                                    
		</div>                                                                                                                                                                                              
	</div>                                                                                                                                                                                              
</div>                                                                                                                                                                                              
		<jsp:include page="footer.jsp"></jsp:include>    
</body>                                                                                                                                                                                             
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>                                                                                                                     
<script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script>                                                                                                            
<script src="http://apps.bdimg.com/libs/angular.js/1.3.9/angular.min.js"></script>                                                                                                                
<script type="text/javascript">                                                                                                                                                                   
	var pageIndex = ${page.pageIndex}; 
	var pageSize = ${page.pageSize};    
$(document).ready(function() {                                                                                                                                                                      
    $("#addBala_files").click(function() {                                                                                                                                                        
        $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/addBala_files.do");                                                                                                       
        $("#Bala_filesForm").submit();                                                                                                                                                            
    });                                                                                                                                                                                             
                                                                                                                                                                                                    
    $("span[id^='delBala_files!!!']").click(function() {                                                                                                                                          
    	var id = $(this).attr('id').replace(/^delBala_files!!!\d+!!!/,'');
    	window.location.href = "${contextPath}/page/"+id+"/"+pageIndex+"/"+pageSize+"/delBala_files.do";
    });                                                                                                                                                                                             
                                                                                                                                                                                                    
    $("td[id^='Bala_filesdata!!!']").click(function() {                                                                                                                                         
    	var n = $(this).attr("id").replace(/^Bala_filesdata!!!(\d+)!!![^!]+$/,"$1");                                                                                                               
    	$("td[id^='Bala_filesdata!!!"+n+"!!!']").each(function(){                                                                                                                                
    		var s = $(this).attr("id").replace(/^Bala_filesdata!!!\d+!!!([^!]+)$/,"$1");                                                                                                           
    		$("#Bala_filesForm").find("input[name='"+s+"']").val($(this).text());                                                                                                                
    	});                                                                                                                                                                                            
    	$("#Bala_filesForm").find("input[id='id']").val($("span[id^='delBala_files!!!"+n+"!!!']").attr("id").replace(/^delBala_files!!!\d+!!!/,""));                                       
    });                                                                                                                                                                                             
                                                                                                                                                                                                    
    $("#updateBala_files").click(function() {                                                                                                                                                     
        $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/updateBala_files.do");                                                                                                    
        $("#Bala_filesForm").submit();                                                                                                                                                            
    });                                                                                                                                                                                             
                                                                                                                                                                                                    
    $("#selectBala_files").click(function() {                                                                                                                                                     
        $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/selectBala_files.do");                                                                                                    
        $("#Bala_filesForm").submit();                                                                                                                                                            
    });                                                                                                                                                                                             
});                                                                                                                                                                                                 
 function gotoPage(pindex){                                                                                                    
 	pageIndex = pindex;                                                                                                       
     $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/selectBala_files.do");      
     $("#Bala_filesForm").submit();                                                                                          
 }                                                                                                                             
 function gotoPrePage(){                                                                                                       
 	pageIndex--;                                                                                                              
     $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/selectBala_files.do");      
     $("#Bala_filesForm").submit();                                                                                          
 }                                                                                                                             
 function gotoNextPage(pindex,psize){                                                                                          
 	pageIndex++;                                                                                                              
     $("#Bala_filesForm").attr("action", "${contextPath}/page/"+pageIndex+"/"+pageSize+"/selectBala_files.do");      
     $("#Bala_filesForm").submit();                                                                                          
 }                                                                                                                             
</script>                                                                                                          
</html>                                                                                                                                                                                             

